package com.study.leetcode;

public class Solution_409 {
    public int longestPalindrome(String s) {
        int[] countChar = new int[64];
        int ans = 0;
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            countChar[c - 'A'] += 1;
        }
        for (int c : countChar) {
            ans += c - (c & 1);
        }
        return ans < s.length() ? ans + 1 : ans;
    }

    public static void main(String[] args) {
        String s= "abccccdd";
        Solution_409 solution409 = new Solution_409();
        System.out.println("solution409.longestPalindrome(s) = " + solution409.longestPalindrome(s));
    }
}
